package com.xuelang.pipeline.artifact.client.resource;

import com.xuelang.pipeline.artifact.client.common.request.PageParam;
import com.xuelang.pipeline.artifact.client.common.result.ApiResult;
import com.xuelang.pipeline.artifact.client.common.result.PageRecord;
import com.xuelang.pipeline.artifact.client.resource.dto.ArtifactNamespaceDTO;
import com.xuelang.pipeline.artifact.client.resource.dto.ArtifactNamespaceQuery;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;
import java.util.List;

/**
 * 镜像仓库命名空间服务接口
 *
 * @author xiwen.zxg
 * @since 2024/5/28
 */
public interface IArtifactNamespaceService {

    /**
     * 查询镜像仓库命名空间列表(有过滤条件，可以分页)
     *
     * @param dtoPageParam
     * @return
     */
    @PostMapping(value = "/pageList", produces = "application/json;charset=utf-8")
    ApiResult<PageRecord<ArtifactNamespaceDTO>> pageArtifactNamespaceList(@RequestBody @Valid PageParam<ArtifactNamespaceQuery> dtoPageParam);

    /**
     * 查询镜像仓库命名空间列表(有过滤条件)
     *
     * @param artifactNamespaceQuery
     * @return
     */
    @PostMapping(value = "/list", produces = "application/json;charset=utf-8")
    ApiResult<List<ArtifactNamespaceDTO>> conditionalArtifactNamespaceList(@RequestBody @Valid ArtifactNamespaceQuery artifactNamespaceQuery);

    /**
     * 新增镜像仓库命名空间
     *
     * @param artifactNamespaceDTO
     * @return
     */
    @PostMapping(value = "", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> addArtifactNamespace(@RequestBody @Valid ArtifactNamespaceDTO artifactNamespaceDTO);

    /**
     * 更新镜像仓库命名空间
     *
     * @param artifactNamespaceDTO
     * @return
     */
    @PutMapping(value = "", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> updateArtifactNamespace(@RequestBody @Valid ArtifactNamespaceDTO artifactNamespaceDTO);

    /**
     * 删除镜像仓库命名空间
     *
     * @param uuid
     * @return
     */
    @DeleteMapping(value = "/{uuid}", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> deleteArtifactNamespace(@PathVariable("uuid") String uuid);

    /**
     * 查询镜像仓库命名空间
     *
     * @param uuid
     * @return
     */
    @GetMapping(value = "/{uuid}", produces = "application/json;charset=utf-8")
    ApiResult<ArtifactNamespaceDTO> queryArtifactNamespace(@PathVariable("uuid") String uuid);
}
